﻿using Newtonsoft.Json;
using Ayatta.Contract.Domain;
using System.Collections.Generic;

namespace Web.Base.Extensions
{
    public static class UserExtension
    {
        /// <summary>
        /// 获取用户登录过的游戏及其区服
        /// </summary>
        /// <param name="o">UserExtra</param>
        /// <returns></returns>
        public static IDictionary<int, Dictionary<int, bool>>GameData(this UserExtra o)
        {
            var dic = new Dictionary<int, Dictionary<int, bool>>();
            if (!string.IsNullOrEmpty(o.Game))
            {
                dic = JsonConvert.DeserializeObject<Dictionary<int, Dictionary<int, bool>>>(o.Game);
            }
            return dic;
        }
    }
}